package liczby;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import org.junit.Ignore;
import org.junit.Test;

import junit.framework.TestCase;

public class LiczbyTestJUnit3 extends TestCase 
{

	protected Liczba l, temp;
	
	public LiczbyTestJUnit3(String name) 
	{
		super(name);
	}

	protected void setUp() throws Exception 
	{
		super.setUp();
		l = new Liczba(10, 5);	
		temp = new Liczba(150342, 4);
	}

	protected void tearDown() throws Exception 
	{
		super.tearDown();
		l = null;
		temp = null;
	}

	public final void testPrzerob() 
	{
		assertEquals(Integer.toString(l.getTestLiczba(),l.getTestSystem()), l.getResult());
	}

	public void testNegativeValueException()
	{
		try
		{
			Liczba.setTestLiczba(-5);
			fail();
		}
		catch(NegativeValueException nve)
		{
			return;
		}
		fail();
	}
	
	public void testWrongSystemException()
	{
		try
		{
			Liczba.setTestSystem(0);
			fail();
		}
		catch(WrongSystemException wse)
		{
			return;
		}
		fail();
	}
	
	public void testPrzerobCzasPracy()
	{
		assertEquals("Udalo mi sie!", Integer.toString(temp.getTestLiczba(), temp.getTestSystem()), temp.getResult());
	}
	
	public void testTemp()
	{
		assertNotNull(temp.getResult());
	}
	
	public void testL()
	{
		assertNotNull("Bezczelny komentarz", l.getResult());
	}
	
	public void testAssertPoRazPiaty()
	{
		assertSame(4, temp.getTestSystem());
	}
}
